#coding:utf8
# vim: tabstop=4 shiftwidth=4 softtabstop=4
"""
Created on May 4, 2013

@author: join
"""

from cvirt.manager.monitor.plugins.plugin import MetaPluginSum


class VCPU(MetaPluginSum):
    plugin_directory = "cpu-[0-9]{1,3}"
    dst_name = "cpu"
    title = 'CPU'

    def gen(self):
        graphs = []
        self.plugin_directory = 'libvirt'
        graph_path = self.graph_meta("libvirt-%s.png")
        graphs += graph_path
        return graphs

    def graph_meta(self, *args):
        values = (
            ('user', '0000ff', 'virt_cpu_total.rrd', "value"),
            # ('wait', 'ffb000', 'cpu-wait.rrd', "value"),
            ('system', 'ff0000', 'virt_cpu_total.rrd', "value"),
            # ('nice', '00e000', 'virt_cpu_total.rrd', "value"),
#            ('softirq', 'ff00ff', 'cpu-softirq.rrd', "value"),
#            ('interrupt', 'a000a0', 'cpu-interrupt.rrd', "value"),
#             ('steal', '000000', 'virt_cpu_total.rrd', "value"),
            ('idle', 'ffffff', 'virt_cpu_total.rrd', "value"),
        )
        return super(VCPU, self).graph_meta(values, *args)
